<template>
	<view>
		<mescroll-body top='' @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
			:down="downOption">
			<view class="plr15">
				<view v-for="(item,index) in withdrawalList" :key="index">
					<view class="ptb12 bdbe">
						<view class="align-center justify-between">
							<text>提现申请- 提现到（{{item.card_no.substr(-4)}}）</text>
							<text>{{item.real_amount}}</text>
						</view>
						<view class="align-center justify-between mt5 ft12 gray9">
							<text>{{item.created_at}}</text>
							<text v-if="item.status==1">提现申请，待处理</text>
							<text v-if="item.status==2">已到账</text>
							<text v-if="item.status==3">提现失败，已退回</text>
						</view>
					</view>
					<view class="ptb12 bdbe">
						<view class="align-center justify-between">
							<text>提现申请- 提现服务费</text>
							<text>{{item.fee}}</text>
						</view>
						<view class="align-center justify-between mt5 ft12 gray9">
							<text>{{item.created_at}}</text>
							<text v-if="item.status==3">提现失败，已退回</text>
						</view>
					</view>

				</view>
			</view>
		</mescroll-body>
	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	export default {
		mixins: [MescrollMixin], // 使用mixin
		data() {
			return {
				downOption: {
					auto: true
				},
				upOption: {
					auto: true
				},
				withdrawalList: [], //提现记录
			}
		},
		methods: {
			// 下拉刷新
			upCallback(page) {
				if (page.num == 1) this.withdrawalList = []; //如果是第一页需手动制空列表
				this.$api.withdrawlog({
					page: 1,
					limit: 20,
				}).then(res => {
					let curPageData = res.data; //当前页的数据列表
					let curPageLen = curPageData?.length; //当前页的数据长度
					let totalPage = res.data.total; //总页数
					let hasNext = (20 == curPageLen ? true : false) //根据页数判断是否有下一页
					this.withdrawalList = this.withdrawalList.concat(curPageData); //追加新数据
					this.mescroll.endSuccess(curPageLen, hasNext);
				})
			},
		}
	}
</script>

<style>
	page {
		background: #ffffff;
	}
</style>